<!DOCUMENT html>
<html>
<head>
	<title>Oráculo Admin</title>
	<meta charset="utf-8" />

	<link rel="stylesheet" href="css/bootstrap.css" />	
	<link rel="stylesheet" href="css/oraculo.css" />
			
	<script type="text/javascript" src="js/jquery-1.8.2.min.js"></script>		
	<script type="text/javascript" src="js/bootstrap.js"></script>	

	<script type="text/javascript">
		$(document).ready(function() {
			$("#reset-btn").click(function(){
				console.log("RESET");
				$("#table-container")[0].innerHTML = "";
				$.ajax({
					type:"POST",
					url:"/admin/list",
					data:{"action":"reset"},
					success:function(){				
						$.ajax({
							type:"POST",
							url:"/admin/list",
							data:{"action":"list"},
							dataType:"text",
							success:function(data){
								$("#table-container")[0].innerHTML = data;
							}
						});
					}
				});
			});
		});

	</script>

</head>
<body>

	<div class="admin-tela">
		{% if action =="login" %}
			<div class="form-login">
				<div class="hero-unit">
					<form class="form-horizontal" action="" method="post">

					  <div class="control-group">
					    <label class="control-label" for="inputPassword">Password</label>
					    <div class="controls">
					      <input type="password" id="password" name="password" placeholder="Password">
					      <input type="hidden" id="action" name="action" value="login">
					      <button type="submit" class="btn">Acessar</button>
					    </div>
					  </div>

					</form>
				</div>
			</div>
		{% else %}
			<div class="hero-unit">
				<button class="btn btn-warning btn-medium admin-btn" id="reset-btn">Resetar Banco</button>		
				<div id="table-container"></div>
			</div>

			<script type="text/javascript">
				$.ajax({
					type:"POST",
					url:"/admin/list",
					data:{"action":"list"},
					dataType:"text",
					success:function(data){
						$("#table-container")[0].innerHTML = data;
					}
				});
			</script>
		{% endif %}
	</div>
</body>
</html>